<?xml version="1.0" encoding="utf-8"?>
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:blueonionsoftware-com:bloget:runtime:data">
  <text>In case you ever want to do this...

The CDS_SET_PRIMARY flag is mentioned in the MSDN, however the magical call sequence is not.  The trick is to call ChangeDisplaySettingsEx() three times.  First two for each monitor, then the 3rd time actually commits the changes.  Also, you need to specify DM_POSITION with the appropriate x-coords for each monitor.  The primary monitor always gets x-coord = 0.

&lt;pre&gt;
	bool  setRightAsPrimary = true;

	DEVMODE devMode;
	devMode.dmSize = sizeof(DEVMODE);
    EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &amp;devMode);
	devMode.dmFields = DM_PELSHEIGHT | DM_PELSWIDTH
		| DM_DISPLAYFREQUENCY | DM_BITSPERPEL | DM_POSITION;
	devMode.dmPelsWidth = 1024;
	devMode.dmPelsHeight = 768;
	devMode.dmDisplayFrequency = 75;
	devMode.dmBitsPerPel = 32;

	POINTL origin;
	origin.x = setRightAsPrimary ? -1024 : 0;
	origin.y = 0;
	devMode.dmPosition = origin;
	DWORD dmFlags = CDS_UPDATEREGISTRY | CDS_NORESET;
	if(!setRightAsPrimary)
	{
		dmFlags |= CDS_SET_PRIMARY;
	}
	long result = ChangeDisplaySettingsEx(
		".Display1",
		&amp;devMode,
		NULL,
		dmFlags,
		NULL);

	origin.x = 0;
	origin.x = 1024;
	origin.y = 0;
	devMode.dmPosition = origin;
	dmFlags = CDS_UPDATEREGISTRY | CDS_NORESET;
	if(setRightAsPrimary)
	{
		dmFlags |= CDS_SET_PRIMARY;
	}
	long result2 = ChangeDisplaySettingsEx(
		".Display2",
		&amp;devMode,
		NULL,
		dmFlags,
		NULL);

    long result3 = ChangeDisplaySettingsEx(NULL, NULL, NULL, 0, NULL);
&lt;/pre&gt;</text>
  <last_update>2007-10-04T00:52:26.7110806Z</last_update>
  <source_title />
  <source_link />
  <comments />
  <references />
  <attachments />
</Content>